<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>1.html</h1>
    <script>
      // 同域
      // http://127.0.0.1:8088/1.html
      // http://127.0.0.1:8088/imgs/1.jpg

      // 跨域
      // http://127.0.0.1:8088/1.html
      // http://localhost:8088/imgs/1.jpg
      const xhr = new XMLHttpRequest();
      // xhr.open("GET", "./imgs/1.jpg");
      // xhr.open("GET", "http://127.0.0.1:8088/imgs/1.jpg");

      // Access-Control-Allow-Origin: http://127.0.0.1:8088
      // xhr.open("GET", "http://localhost:8088/imgs/1.jpg");

      // http://127.0.0.1:8088/1.html
      // "baseUri": "/api",
      xhr.open("GET", "http://127.0.0.1:8088/api/user");
      xhr.onload = function () {
        console.log(xhr.response);
      };
      xhr.send();
    </script>
  </body>
</html>
